<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model backend\modules\api\models\ApiRoleRoute */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="api-role-route-form">

    <?php $form = ActiveForm::begin(); ?>

	<?= $form->field($model, 'api_role_id')->widget(\kartik\select2\Select2::className(),[
		'data'=>\yii\helpers\ArrayHelper::map(\common\models\ApiRole::find()->asArray()->all(),'id', 'name'),
	])->label('角色') ?>
 
	<?= $form->field($model, 'api_route_id')->widget(\kartik\select2\Select2::className(),[
		'data'=>\yii\helpers\ArrayHelper::map(\common\models\ApiRoute::find()->asArray()->all(),'id', 'name'),
	])->label('路由') ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
